def run_length_encoding(s):
  encoded_string_characters = []
  current_run_length = 1 

  for i in range(1, len(s)):
    curr_char = s[i]
    prev_char = s[i - 1]

    if curr_char != prev_char or current_run_length == 9:
      encoded_string_characters.append(str(current_run_length))
      encoded_string_characters.append(prev_char)
      current_run_length = 0
    
    current_run_length += 1

  encoded_string_characters.append(str(current_run_length))
  encoded_string_characters.append(s[len(s) - 1])

  return "".join(encoded_string_characters)

print(run_length_encoding("AAABBBCCCCCCCC"))